package com.hk.webapp.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hk.webapp.bean.CareerInfo;
import com.hk.webapp.bo.CareerInfoBo;
import com.hk.webapp.dao.CareerInfoMapper;
import com.hk.webapp.service.CareerInfoService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional(readOnly = true)
public class CareerInfoServiceImpl  implements CareerInfoService {
    @Resource
    private CareerInfoMapper careerInfoMapper;

    @Override
    public PageInfo<CareerInfoBo> GetCareerList(Integer pageIndex, Integer pageSize, Integer city_id, Integer job_id, Integer type_id, Integer status) {
        PageHelper.startPage(pageIndex,pageSize);
        List<CareerInfoBo> list=careerInfoMapper.GetCareerList(city_id,job_id,type_id,status);
        PageInfo<CareerInfoBo> plist=new PageInfo<>(list);
        return plist;
    }

    @Override
    public CareerInfo GetEntityById(Integer id) {
        return careerInfoMapper.selectByPrimaryKey(id);
    }

    @Override
    @Transactional
    public int insert(CareerInfo careerInfo) {
        return careerInfoMapper.insertSelective(careerInfo);
    }

    @Override
    @Transactional
    public int update(CareerInfo careerInfo) {
        return careerInfoMapper.updateByPrimaryKeySelective(careerInfo);
    }

    @Override
    @Transactional
    public int softDeleteByIds(List<Integer> ids) {
        return careerInfoMapper.softDeleteByIds(ids);
    }
}
